#include <iostream>

using namespace std;

struct student
{
	int id;
	float gpa;
};

template < class T >
class store
{
private:
	T item;
	int have_value;
public:
	store(void);

	T get_elem(void);
	void put_elem(T x);
};

template < class T>
store<T> ::store(void):have_value(0)
{
	
}

template <class T>
T store<T> ::get_elem(void)
{
	if (have_value == 0)
	{
		cout << " No item present!" << endl;
		exit(1);
	}

	return item;
}

template <class T>
void store<T>::put_elem(T x)
{
	have_value++;
	item = x;
}

void main()
{
	student g = {1000, 23};
	store<int> s1, s2;
	store<student> s3;

	store<double> d;
	s1.put_elem(3);
	s2.put_elem(-7);
	cout << s1.get_elem() << " " << s2.get_elem() << endl;
	s3.put_elem(g);
	cout << " The student id is " << s3.get_elem().id << endl;
	cout << " Retrieving object D ";
	cout << d.get_elem() << endl;
}